package com.lntu.meeting.controller;

import com.lntu.meeting.service.DeleteService;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class DeleteController {
    @Autowired
    private DeleteService deleteService;
    @RequestMapping("/deleteOne")
    public String delete(Integer id){
        Map<String,Object> resMap = new HashMap();

        if (id!=null){
            Integer num = deleteService.deleteByiId(id);
            if (num != 1){
                resMap.put("flag",-1);
                return  JSON.toJSONString(resMap);

            }
            resMap.put("flag", 1);
         String  res = JSON.toJSONString(resMap);
         return res;
        }
        resMap.put("flag",-1);
        return  JSON.toJSONString(resMap);
    }
}
